$OpenBSD: patch-configure,v 1.53 2017/05/27 06:38:23 espie Exp $

Index: configure
--- configure.orig
+++ configure
@@ -1593,7 +1593,7 @@ static __thread int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-if ! compile_prog "-Werror" "" ; then
+if ! compile_prog "-Werror" "-pthread" ; then
     error_exit "Your compiler does not support the __thread specifier for " \
 	"Thread-Local Storage (TLS). Please upgrade to a version that does."
 fi
@@ -2985,6 +2985,7 @@ if test "$curses" != "no" ; then
   fi
   curses_found=no
   cat > $TMPC << EOF
+#define _XOPEN_SOURCE_EXTENDED
 #include <locale.h>
 #include <curses.h>
 #include <wchar.h>
@@ -4787,10 +4788,6 @@ fi
 if test "$gcov" = "yes" ; then
   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
-elif test "$fortify_source" = "yes" ; then
-  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
-elif test "$debug" = "no"; then
-  CFLAGS="-O2 $CFLAGS"
 fi
 
 ##########################################
@@ -4939,7 +4936,7 @@ if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a 
     # Different host OS linkers have different ideas about the name of the ELF
     # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd
     # variant; and Windows uses i386pe.
-    for emu in elf_i386 elf_i386_fbsd i386pe; do
+    for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
         if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
             ld_i386_emulation="$emu"
             roms="optionrom"
